package com.dragon.graduation.midtermDefense.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.graduation.midtermDefense.controller.dto.MidtermDefenseSearchDTO;
import com.dragon.graduation.midtermDefense.controller.vo.MidtermDefenseVO;
import com.dragon.graduation.midtermDefense.entity.MidtermDefenseEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 中期答辩表 Mapper 接口
 * </p>
 *
 * @author dragon
 * @since 2025-02-28 21:19:15
 */
@Mapper
public interface MidtermDefenseMapper extends BaseMapper<MidtermDefenseEntity> {

    Page<MidtermDefenseVO> selectPages(Page<MidtermDefenseEntity> entityPage, @Param("searchDTO") MidtermDefenseSearchDTO searchDTO);

    @Select("select * from db_midterm_defense where project_id = #{projectId} and student_id = #{studentId} and status!=2 ORDER BY update_time DESC LIMIT 1")
    MidtermDefenseEntity selectByProjectIdAndStudentId( @Param("projectId") Integer projectId,@Param("studentId") Integer studentId);
}
